<?php 
    Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/newdispatch.js',  CClientScript::POS_BEGIN);
    ?>
<div id="left-col">
    <div class="container" style="min-height: 206px;">   

        <div class="heading"><a id="sidebaropengear" onclick="showSideBarSettings();" href="javascript:void(0);"><img width=16" height="16" src="./images/gear.png" alt="" /></a>Information</div>
        <div id="selectedcustomernav" class="inside" style="padding-bottom:0px !important;">
            <input type="text" id="remote-users" style="width:143px !important;display:none"/>                
        </div>

        <div class="inside" style="padding-top:0px; padding-bottom:0px;">
            <h5 style="padding-left:11px;">Available Actions</h5>
            <ul class="links" style="margin-left:0px !important;">
                <li id='blankforvalidation2' style="display:none">&nbsp;</li>                               

                <li><?php echo CHtml::link('Dispatch list', array('/dispatch')); ?></li>

            </ul>
        </div>





    </div>
</div>
<div id="right-col">
    <div class="wrap">
        <div class="container">
            <div class="inside">
                <h1>Add Internal Dispatch</h1>
                <div class="form">
                <?php $form = $this->beginWidget('CActiveForm',array(
                    'id'=>'newDispatchForm'
                )); ?>
                    <div class="row">
                        <?php
                        echo $form->labelEx($model, 'custno');
                        echo $form->dropDownList($model, 'custno', CustomerUtil::getCustomersList(),array('disabled'=>1));
                        echo $form->error($model, 'custno');
                        ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model, 'locno');  ?>
                        <?php echo $form->dropDownList($model, 'locno',array($model->locno=>$model->locno),array('disabled'=>1)); ?>
                        <?php echo $form->error($model, 'locno'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'calledinby'); ?>
                        <?php echo $form->textField($model,'calledinby'); ?>
                        <?php echo $form->error($model,'calledinby'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'department'); ?>
                        <?php echo $form->dropDownList($model,'department',$model->getDepartmentList(),array('disabled'=>1)); ?>
                        <?php echo $form->error($model,'department'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'priority'); ?>
                        <?php echo $form->dropDownList($model,'priority',$model->getPriorityList()); ?>
                        <?php echo $form->error($model,'priority'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'receivedtime'); ?>
                        <?php $this->widget('CMaskedTextField',array(
                            'model'=>$model,
                            'attribute'=>'receivedtime',
                            'mask'=>'99:99:99',                            
                        )); ?>
                        <?php echo $form->error($model,'receivedtime'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'receiveddate'); ?>
                        <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array(
                            'model'=>$model,
                            'attribute'=>'receiveddate',
                            'value'=>CTimestamp::formatDate('Y-m-d',$model->receiveddate),
                            'options' => array('dateFormat'=>'yy-m-d'),
                        )); ?>
                        <?php echo $form->error($model,'receiveddate'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'ponumber'); ?>
                        <?php echo $form->textField($model,'ponumber'); ?>
                        <?php echo $form->error($model,'ponumber'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'wonumber'); ?>
                        <?php echo $form->textField($model,'wonumber'); ?>
                        <?php echo $form->error($model,'wonumber'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'jobnumber'); ?>
                        <?php echo $form->textField($model,'jobnumber',array()); ?>
                        <?php echo $form->error($model,'jobnumber'); ?>
                    </div>
                    <div class="row">
                        <?php echo $form->labelEx($model,'notes'); ?>
                        <div class="model-data">
                            <a href="javascript:void(0);" onclick="insertAtCaret('Dispatchdetails_notes',getDate()+' ');">Insert time</a>
                            <?php echo $form->textArea($model,'notes',array('rows'=>6, 'cols'=>50)); ?>
                        </div>
                        <?php echo $form->error($model,'notes'); ?>
                    </div>
                    <div class="row_buttons">
                        <?php echo CHtml::submitButton('Save'); ?>
                    </div>
                <?php $this->endWidget(); ?>
                </div>
            </div>
        </div>
    </div>
</div>